<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>123</div>
    <script>
        const obj = {
            uname: 'xiaoheizi'
        }

        // function fn (a = 1, b = 1) {
        //     console.log(this);
        //     console.log(a + b);
        //     console.log(arguments);
        //     // arguments.forEach(item => console.log(item))
        //     Array.prototype.forEach.call(arguments, item => console.log(item))
        //     console.log(Array.prototype.filter.call(arguments, item => item === 1));
        // }
        // fn(1, 1, 2, 3, 4, 5)
        // console.dir(fn)
        // fn.call(obj, 2, 3)
        // console.log(Object.prototype.toString.call(fn));
        // console.log(fn.toString());

        // function fn (...arr) {
        //     console.log(this);
        //     // console.log(a, b, c);
        //     console.log(arr);
        //     arr.forEach(item => console.log(item))
        // }

        // // fn([1, 2, 3])
        // fn.apply(obj, [1, 2, 3])

        // const max = Math.max.apply(null, [1, 2, 3])
        // console.log(max);

        // function fn (a, b) {
        //     console.log(this);
        //     console.log(a, b);
        // }

        // fn.bind(obj, 1, 2)

        const clickTest = () => {
            console.log(this);
        }

        document.querySelector('div').onclick = clickTest.bind(obj)
    </script>
</body>

</html>